﻿; (function (window, undefined, $) {

    $(document).ready(function () {
        
        $.post("/Module/UserModuleList.html", null,
                 function (res) {
                     var module = "";
                     var newmodulelayer = "";
                     var oldmodulelayer = "";
                     $(res).each(function () {
                         //module += this.Name;
                         newmodulelayer = this.Layer;
                         if (this.Layer != 0) {
                             if (this.Layer != 1) {
                                 //module += "<h3 @(ViewBag.ControllerName == \"home\" ? cssCurrent : cssNone)>" + this.Name + "</h3>";
                                 if (newmodulelayer > oldmodulelayer) {
                                     module += "<ul><li><a href=\"/Web/ArticleList.html\">" + this.Name + "</a></li>";

                                 } else {
                                     module += "<li><a href=\"/Web/ArticleList.html\">" + this.Name + "</a></li>";

                                 }

                             } else {
                                 if (newmodulelayer < oldmodulelayer) {
                                     module += "</ul>";
                                 }
                                 module += '<h3>' + this.Name + '</h3>';
                                 //if (this.Name == "网站管理") {
                                 //    module += '<h3 @(ViewBag.ControllerName == "home" ? cssCurrent : cssNone)>' + this.Name + '</h3>';
                                 //} else if (this.Name == "会员管理") {
                                 //    module += '<h3 @(ViewBag.ControllerName == "member"||ViewBag.ControllerName == "fundsflow" ? cssCurrent : cssNone)>' + this.Name + '</h3>';
                                 //} else if (this.Name == "项目管理") {
                                 //    module += '<h3 @(ViewBag.ControllerName == "project" ? cssCurrent : cssNone)>' + this.Name + '</h3>';
                                 //} else if (this.Name == "系统管理") {
                                 //    module += '<h3 @(ViewBag.ControllerName == "system"||ViewBag.ControllerName == "dept" ? cssCurrent : cssNone)>' + this.Name + '</h3>';
                                 //} else {
                                 //}
                             }
                         }
                         oldmodulelayer = this.Layer;
                     });
                     module += "</ul>";

                     //alert(module);

                     $("#module").html(module);
                 },
                 "json"
           );

       
    });

})(window, undefined, jQuery);